<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>停留在页面的时间</title>
</head>
<body>
    <span id="show"></span>
    <script scr="js/utlis.js"></script>
    <script>
        var preDate=new Date();
        var newDate=new Date();
        var res=chaTime(preDate,newdate);
        console.log(res)
        show.innerHTML=res;
        setInterval(function(){
            newDate=new Date();
            var res=chaTime(preDate,newDate);
            show.innerHTML=res;
        },100);
    </script>
    
</body>
</html>